home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 2
/
Gekikoh Dennoh Club Vol. 2 (Japan).7z
/
Gekikoh Dennoh Club Vol. 2 (Japan) (Track 01).bin
/
kowin
/
font
/
fonted31.lzh
/
fed3pop.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-24
|
3KB
|
124 lines
/*/ ******************************************************************* /*/
/*/ /*/
/*/ FONTED3.win version 1 小笠原博之 SPS0783 COR. /*/
/*/ /*/
/*/ ******************************************************************* /*/
#include <stdio.h>
#include <wlib.h>
#include <parts.h>
#include <winop.h>
#include "fed3const.h"
#include "fonted3.h"
char *savemenu[]={
"PED include",
"PED source",
"GBACK file",
"bit image"
};
extern lineinput();
savefont( wp )
WindowID wp;
{
int mode,
i;
unsigned int x,
y;
FILE *fp;
char inputbuf[80];
unsigned short imgbuf[16];
char abuf[40];
char bbuf[80];
for( x=0 ; x<16 ; x++ )
imgbuf[x]= ~ImgBuf[x];
x= MS_CURGT();
y= x & 0xffff;
x >>= 16;
mode= PopUpMenu( x-2, y+1, savemenu, 4, 12 );
if( mode >= 0 ){
*inputbuf= '\0';
areamsg( wp, "ファイル名? " );
lineinput( inputbuf );
if( *inputbuf == '\0' ){
areamsg( wp, 0 );
return FALSE;
}
if( mode < 2 )
strmfe( bbuf, inputbuf, mode==1 ? "c" : "inc" );
else
strcpy( bbuf, inputbuf );
if( (fp= fopen( bbuf, "wb" ))== 0 ){
areamsg( wp, "open error! " );
return FALSE;
}
stcgfn( abuf, inputbuf );
areamsg( wp, "セーブ中 " );
switch( mode ){
case 1:
fputs( "#include \"wlib.h\"\r\n\r\n", fp );
case 0:
fprintf( fp, "static\tshort\t%s1[] = {\r\n\t", abuf ); /* } */
for( i=0 ; i<15 ; i++ )
fprintf( fp, "0x%04X, ", ImgBuf[i] );
/* { */ fprintf( fp, "0x%04X\r\n};\r\n", ImgBuf[15] );
fprintf( fp, "static\tshort\t%s2[] = {\r\n\t", abuf ); /* } */
for( i=0 ; i<15 ; i++ )
fputs( "0x0000, ", fp );
/* { */ fprintf( fp, "0x0000\r\n};\r\n%sSheet\t%sPattern = { 16, 16, 1, %s1, %s2 };\r\n", mode==1?"":"static\t", abuf, abuf, abuf );
break;
case 2:
putw( 16, fp );
putw( 16, fp );
fwrite( ImgBuf, 32, 1, fp );
break;
case 3:
fwrite( imgbuf, 32, 1, fp );
break;
}
fclose( fp );
areamsg( wp, "セーブ終了" );
return TRUE;
}
}
loadfont( fname )
char *fname;
{
FILE *fp;
if( fp= fopen( fname, "rb" ) ){
if( getc(fp) < ' ' ){
fseek( fp, 4, 0 );
fread( ImgBuf, 32, 1, fp );
}else{
unsigned short *data= ImgBuf;
int i;
char sbuf[200];
freopen( fname, "r", fp );
while( fgets( sbuf, 200, fp ) )
if( strncmp( sbuf, "static", 6 ) == 0 )
break;
for( i= 0 ; i< 16 ; i++ ){
int a;
fscanf( fp, "0x%X, ", &a );
*data++= a;
}
}
fclose( fp );
return TRUE;
}
return FALSE;
}